package org.cpoy.ei.session;

import org.cpoy.eims.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("parentList")
public class ParentList extends EntityQuery<Parent> {

	private static final String EJBQL = "select parent from Parent parent";

	private static final String[] RESTRICTIONS = {
			"lower(parent.firstName) like lower(concat(#{parentList.parent.firstName},'%'))",
			"lower(parent.lastName) like lower(concat(#{parentList.parent.lastName},'%'))",
			"lower(parent.email) like lower(concat(#{parentList.parent.email},'%'))", };

	private Parent parent = new Parent();

	public ParentList() {
		setEjbql(EJBQL);
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
		setMaxResults(25);
	}

	public Parent getParent() {
		return parent;
	}
}
